<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        img {
            width: 300px;
            height: 200px;
        }
    </style>
</head>
<body>
    <img src="常用元素的属性操作.png" alt="">
    <br>
    <button id='ldh'>1</button>
    <button id='zxy'>2</button>
    <br>
    <img class="change" src="../JS基础/变量小结.png" alt="" title="变量小结">
    <script>
        // 修改元素属性 src
        // 1. 获取元素
        var ldh = document.getElementById('ldh');
        var zxy = document.getElementById('zxy');
        var img = document.querySelector('.change');
        // 2. 注册点击事件
        zxy.onclick = function() {
            img.src = '../JS基础/基本包装类型.png'
            img.title = '基本包装类型';
        }
        ldh.onclick = function() {
            img.src = '../JS基础/变量小结.png'
            img.title = '变量小结';
        }
    </script>
</body>
</html>